package com.mm.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mm.entity.vo.ColumnInfo;
import com.mm.entity.vo.TableInfo;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface GeneratorMapper {

    @Select("select table_name ,create_time , engine, table_collation, table_comment from information_schema.tables " +
            "where table_schema = (select database()) " +
            "order by create_time desc")
    IPage<TableInfo> getTables(Page page);


    @Select(" select column_name, is_nullable, data_type, column_comment, column_key, extra from information_schema.columns " +
            " where table_name = #{tableName} and table_schema = (select database()) order by ordinal_position")
    List<ColumnInfo> getTableColumns(String tableName);


}
